<?php echo $this->css('css/spotlights.css'); ?>

<div class="cms-content-header">Spotlights</div>

<div id="content-pane" class="cms-content-pane"> 
    <div class="articles-pane"> 

        <div class="pane-sub-header"> 
            <label for="checkall" style="margin-right: 10px; padding-right: 10px; border-right: dotted #999 1px;"><input id="checkall" type="checkbox" /> Select All</label>
            <a id="add-link" href="<?php echo $this->url(array('action' => 'add')); ?>"> <img src="images/icons/newspaper_add.png" alt="add" width="16" height="16" border="0" align="absmiddle" /> Add Spotlight </a> 
            <a id="del-selected-link" href="<?php echo $this->url(array('action' => 'delete_selected')); ?>"> <img src="images/icons/newspaper_delete.png" alt="del" width="16" height="16" border="0" align="absmiddle" /> Delete Selected </a> 
        </div>
        <div id="articles-display" class="pane-content">
            <ul class="image-list">
                <?php
                foreach ($spotlights as $spotlight) {
                    ?>
                    <li>
                        <div style="cursor: pointer;"><?php echo $spotlight->render(array('width' => 150, 'data-title' => $spotlight->getTitle())); ?></div>
                        
                        <div class="options"> 
                            <input type="checkbox" value="<?php echo $spotlight->getId(); ?>" />
                            <a href="<?php echo $this->url(array('action' => 'edit', 'id' => $spotlight->getId())); ?>" class="edit-link"><img src="images/icons/image_edit.png" alt="edit" width="16" height="16" border="0" align="absmiddle" /> Edit&nbsp; </a> 
                            <a href="<?php echo $this->url(array('action' => 'delete', 'id' => $spotlight->getId())); ?>" class="delete-link" data-id="<?php echo $spotlight->getId(); ?>" ><img src="images/icons/image_delete.png" alt="delete" width="16" height="16" border="0" align="absmiddle" /> Delete</a> 
                            <?php
                            $page_id = $spotlight->getId();
                            $published = $spotlight->field('approved');
                            $publish_class = $published == "true" ? "cms-publish-link" : "cms-unpublish-link";
                            $publish_title = $published == "true" ? "Published (Click To Unpublish)" : "Unpublished (Click To Publish Now)";
                            $url = $this->url(array('action' => 'publish'));
                            
                            echo "<a id='$page_id' href='$url' class='$publish_class' title='$publish_title'></a>";
                            ?>
                        </div>
                    </li>
                <?php } ?>
            </ul>
        </div>
        <div class="pane-footer"> &nbsp; <!--Pages:--> </div>
    </div> 
</div>

<?php echo $this->script('js/spotlights.js'); ?>
<?php echo $this->CMS->script('tiny_mce/tiny_mce.js'); ?>